package com.ruoyi.business.enums;

import java.util.Arrays;
import java.util.Optional;

public enum EffectiveEnum {
    effective(1,"有效的") ,
    invalid(0,"无效的") ;
    private Integer code ;
    private String desc ;

    EffectiveEnum(int code, String desc){
        this.code = code ;
        this.desc = desc ;
    }

    public static boolean checkExist(int code){

        Optional<EffectiveEnum> effectiveEnumOp = Arrays.stream(EffectiveEnum.values()).filter(effectiveEnum -> effectiveEnum.code == code).findFirst() ;
        return effectiveEnumOp.isPresent() ;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
